package com.xiaojie.learn.spring.async;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;

import java.util.concurrent.Future;

@Async
public class LogService {

    public void log(String msg){
        System.out.println(Thread.currentThread() + "开始记录日志，"+System.currentTimeMillis());
    }

    public Future<String> getGoodsInfo(long goodsId) throws InterruptedException {
        return AsyncResult.forValue(String.format("商品%s基本信息!", goodsId));
    }

}
